|
|
|
|
|
|
|
Figure 6.8
Program BinCont uses binary contrast enhancement to
make visible subtle differences in color. |
|
|
|
|
|
|
|
|
routine compares pixel brightness to a cutoff value and determines which should be black and which should be white. |
|
|
|
 |
|
|
|
|
' Transform the image. Private Sub TransformImage(ByVal cutoff As Single)
Dim pixels() As RGBTriplet
Dim bits_per_pixel As Integer
Dim brightness As Integer
Dim X As Integer
Dim Y As Integer
' Get the pixels from picOriginal. GetBitmapPixels picOriginal, pixels, bits_per_pixel
' Set the pixel color values. For Y = 0 To picOriginal.ScaleHeight - 1
For X = 0 To picOriginal.ScaleWidth - 1
With pixels(X, Y)
brightness = (CInt(.rgbRed) + _
.rgbGreen + .rgbBlue) / 3
If brightness >= cutoff Then
.rgbRed = 255
.rgbGreen = 255
.rgbBlue = 255
Else
.rgbRed = 0
.rgbGreen = 0
.rgbBlue = 0
End If
End With
Next X
Next Y |
|
|
|
|
|